<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>

  <script>
    //隐式转换
    var isAdmin = true
    var num1 = 123
    // 分支语句中 先将其他类型转换成布尔类型,再进行判断
    if (num1) { }
    // 直观上为空的值,转出Boolean为false
    // 0 "" undefined null NaN

    //显式转换
    console.log(
      Boolean(0),
      Boolean(""),
      Boolean(undefined),
      Boolean(null),
      Boolean(NaN),
    )
    console.log(Boolean(num1))
  </script>
</body>

</html>